package com.balad.elements;

import java.util.List;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

import android.graphics.drawable.Drawable;
import android.os.Bundle;

public class VilleMapActivity extends MapActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.villemap);
        
		String villelibelle = getIntent().getStringExtra("villelibelle");
		Double villelat = getIntent().getDoubleExtra("villelong", 0);
		Double villelong = getIntent().getDoubleExtra("villelat",0);
		

		
        MapView map = (MapView)findViewById(R.id.map);
        MapController mapController = map.getController();
        GeoPoint point = new GeoPoint((int)(villelong*1E6),(int)(villelat*1E6));
        
        Drawable drawable = this.getResources().getDrawable(R.drawable.maps_icon);
        ListItimizedOverlay itemizedoverlay = new ListItimizedOverlay(drawable,this);
         
        GeoPoint geoPoint = new GeoPoint((int)(villelong*1E6),(int)(villelat*1E6));
        OverlayItem overlayitem = new OverlayItem(geoPoint, "Ville", villelibelle );
        itemizedoverlay.addOverlayItem(overlayitem);
        
        List<Overlay> mapOverlays = map.getOverlays();
        mapOverlays.add(itemizedoverlay);
        
        
        mapController.setCenter(point);
        mapController.setZoom(16);
        map.invalidate();
    }

    @Override
    protected boolean isRouteDisplayed() { return false; }
}
